Ext.define('Admin.view.main.MainModel', {
    extend: 'Ext.app.ViewModel',

    alias: 'viewmodel.main',

    data : {
        // 左边栏基础数据
        westBaseWidth : Ext.Element.getViewportWidth() / 5,
        westMinWidth : 150,
        westMaxWidth : 500,
        westBaseScale : 5
    },
    formulas: {
        selectionText: function(get) {
            var selection = get('treelist.selection'),
                path;
            if (selection) {
                path = selection.getPath('text');
                path = path.replace(/^\/Root/, '');
                return 'Selected: ' + path;
            } else {
                return 'No node selected';
            }
        }
    },

    stores: {
        navItems: {
            type: 'tree',
            root: {
                expanded: true,
                children: [{
                    text: '主页',
                    routeId : 'homepage-view',
                    iconCls: 'x-fa fa-home',
                    leaf: true
                },{
                    text: '分组配置',
                    routeId : 'group-view',
                    iconCls: 'x-fa fa-wrench',
                    children: [{
                        text: '菜单组配置',
                        routeId : 'group-menu-view',
                        iconCls: 'x-fa fa-tag',
                        leaf: true
                    },{
                        text: '项目组配置',
                        routeId : 'group-project-view',
                        iconCls: 'x-fa fa-database',
                        leaf: true
                    }]
                },{
                    text: '任务配置',
                    routeId : 'task-view',
                    iconCls: 'x-fa fa-wrench',
                    children: [{
                        text: '检测标志配置',
                        routeId : 'task-operation-detection-view',
                        iconCls: 'x-fa fa-tag',
                        leaf: true
                    },{
                        text: '标志操作配置',
                        routeId : 'task-operation-setting-view',
                        iconCls: 'x-fa fa-database',
                        leaf: true
                    }]
                },{
                    text: '其他',
                    routeId : 'setting-view',
                    iconCls: 'x-fa fa-wrench',
                    children: [{
                        text: '404',
                        routeId : 'page404-view',
                        iconCls: 'x-fa fa-sliders',
                        leaf: true
                    }]
                },]
            }
        }
    }
});